/*
 * @Description: 
 * @Date: 2020-09-04 16:42:36
 * @Author: 黄治恩
 */

// 用于修改antd的颜色
const CracoLessPlugin = require('craco-less')
// 习惯用sass
const sassResourcesLoader = require('craco-sass-resources-loader');
const path = require('path');

const pathResolve = pathUrl => path.join(__dirname, pathUrl)

module.exports = {
  webpack: {
    alias: {
      '@': pathResolve('src'),
      '~': pathResolve('src/assets'),
    }
  },
  babel: {
    plugins: [
      ['import', { libraryName: 'antd', style: true }],
      ['@babel/plugin-proposal-decorators', { legacy: true }]
    ]
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
      	// 用于配置antd主题颜色
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: {
              '@primary-color': '#4ACA6D'
            },
            javascriptEnabled: true
          }
        }
      }
    },
    {
      plugin: sassResourcesLoader,
      options: {
        resources: ['./src/style/index.scss'],
      },
    }
  ]
}
